<?php

class ExportController extends Controller {

    public function actionIndex() {
        $this->render('index');
    }

    public function actionView() {
        $id = Yii::app()->request->getParam('id', 0);
        $data = array();
        if (!empty($id)) {
            $picture = Picture::model()->findByPk($id);
            if ($picture) {
                $data = $picture->attributes;
            }
        }
        echo json_encode($data);
    }

    public function actionList() {
        $pictures = Picture::model()->recently()->findAll();
        $result = array();
        if ($pictures) {
            foreach ($pictures as $value) {
                $result[] = $value->attributes;
            }
        }
        echo json_encode($result);
    }

}